Skip to content

fix: Aggregate destroyAccumulator memset call with dynamic class input#14568

Closed
nmahadevuni wants to merge 1 commit intofacebookincubator:mainfrom
nmahadevuni:fix_accumulator_memset
Closed

fix: Aggregate destroyAccumulator memset call with dynamic class input#14568
nmahadevuni wants to merge 1 commit intofacebookincubator:mainfrom
nmahadevuni:fix_accumulator_memset

Conversation

@nmahadevuni
Copy link
Copy Markdown
Collaborator

If we use a dynamic class in the Accumulator, then the memset call in destroyAccumulator fails during build with

velox/velox/exec/Aggregate.h:437:16: error: destination for this 'memset' call is a pointer to class containing a dynamic class 'update_theta_sketch_alloc<std::allocator<unsigned long long>>'; vtable pointer will be overwritten [-Werror,-Wdynamic-class-memaccess]
  437 |       ::memset(accumulator, 0, sizeof(T));

Encountered this when working on prestodb/presto#25685

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 22, 2025
@netlify
Copy link
Copy Markdown

netlify Bot commented Aug 22, 2025

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 97804af
🔍 Latest deploy log https://app.netlify.com/projects/meta-velox/deploys/68ab36a7e827d600080122ab

Comment thread velox/exec/Aggregate.h Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The style guidance is to use static_cast

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Yuhta, @aditi-pandit for the review. I have addressed the comment. Please review.

@nmahadevuni nmahadevuni force-pushed the fix_accumulator_memset branch from c128b05 to 97804af Compare August 24, 2025 15:58
@nmahadevuni
Copy link
Copy Markdown
Collaborator Author

@Yuhta Can you please review this?

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@Yuhta has imported this pull request. If you are a Meta employee, you can view this in D81692109.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@Yuhta merged this pull request in c12e666.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants